import React from 'react'
// ===================================================================== Temp
// ===================================================================== global declare
const { $Lazy, $http } = window
// ===================================================================== Lazy
const Echart 		= $Lazy.load(()=>import('../../cpt/echart'))
// ===================================================================== component
class Index extends React.Component{
	state = {
		data: {},
		key: 0
	}
	
	model = {}

	componentDidMount(){
		this.init()
	}
	
	init = (values = {}) => {
		const { uuid } = this.props.thisRef.cRow
		$http.pull(this, 'qc-data/chart', {param: {test_id: uuid, ...this.model, ...values}}).then(() => this.setState({key: this.state.key + 1}))
	}
	
	render(){
		const { data, key } = this.state
		return <>
			<div className='fxmj mtb5 plr5'>
				<span className='cp' style={{color: '#208FA0', fontWeight: 700, borderBottom: '2px solid #208FA0'}}>图表</span>
			</div>
			<div>
				<Echart key={key} rawData={data}/>
			</div>
		</>
	}
}

export default Index